﻿using System.Threading.Tasks;
using System.Windows.Media;
using MahApps.Metro.Controls;

namespace Red.Controls.Shell
{
    public class RedWindow : MetroWindow
    {
        #region C-tor

        public RedWindow()
        {
            // Drop black shadow - both active and non-active
            GlowBrush = new SolidColorBrush( Color.FromRgb( 0, 0, 0 ) );
            NonActiveGlowBrush = GlowBrush;
            TitleCaps = false;
        }

        #endregion C-tor

        #region Public Methods

        /// <summary>
        ///     Shows the dialog. Async version is like showing the dialog non-modally, with task finished when user takes an action.
        /// </summary>
        public Task ShowAsync()
        {
            var tcs = new TaskCompletionSource<bool>();

            Closed += ( object sender, System.EventArgs e ) => tcs.SetResult( true );

            Show();
            return tcs.Task;
        }

        #endregion Public Methods
    }
}
